import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'

Vue.use(Vuex)

const state = {
    order:[
      {id:3,title:'订单3'},
      {id:1,title:'订单1'},
      {id:2,title:'订单2'}
    ],
    test:[]
}

const mutations = {
    setTest(state,param){
        state.order = param.arr;
    }
}

const actions = {
  loadExa(store){
    axios.get('tlwallet/TestServlet.action').then(resp =>{
        store.commit('setTest',resp.data);
    });
  }

}

const getters = {
    getOrder(state){
        return state.order;
    }
}

export default new Vuex.Store({
  state,
  getters,
  actions,
  mutations
})
